package com.lry.crawlers.video.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lry.crawlers.video.entity.VideoUpdate;
import com.lry.crawlers.video.mapper.VideoUpdateMapper;
import com.lry.crawlers.video.service.VideoUpdateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VideoUpdateServiceImpl implements VideoUpdateService {
    @Autowired
    VideoUpdateMapper videoUpdateMapper;

    @Override
    public int setVideoUpdate(VideoUpdate videoUpdate) {
        return videoUpdateMapper.insert(videoUpdate);
    }

    @Override
    public List<VideoUpdate> getVideoUpdates() {
        return videoUpdateMapper.selectList(null);
    }

    @Override
    public int setVideoUpdateUp(VideoUpdate videoUpdate) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("video_id", videoUpdate.getVideoId());
        return videoUpdateMapper.update(videoUpdate,wrapper);
    }



}
